<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>
<@head>
<link rel="stylesheet" href="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.css"/>
</@head>
<@body>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/moment.min.js"></script>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.js"></script>
<script src="/misc/app/js/salesman_payment.js"></script>
</@body>
<@layout_default>
<div class="box">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">未支付</a>
        </li>
        <li role="presentation"><a href="/paymentoff">已支付</a></li>
    </ul>
   
    <div class="box-header with-border">
        <form name="form_query" class="form-inline" action="/payment">
             <input type="hidden" name="timeLimitStart" value="${timeLimitStart!}"/>
            <input type="hidden" name="timeLimitEnd" value="${timeLimitEnd!}"/>
            <span class="pull-right text-muted">共 ${pagelist.resultTotal} 条记录</span>
        	<input type="hidden" id="resultTotal_hidden" value="${pagelist.resultTotal}" />
            <div class="input-group">
                <div class="input-group-addon">产品</div>
                <input type="text" class="form-control" style="width: 260px" name="keyword" value="${keyword!}" placeholder="产品编码 产品名称"/>
            </div>
             <div class="input-group">
                <div class="input-group-addon">扫码时间</div>
                <input type="text" class="form-control" id="timelimitstart_and_timelimitstart" style="width: 200px" placeholder="扫码时间" />
            </div>
            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>
        </form>
    </div>
    
    
    <!-- /.box-header -->
    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>ID</th>
                <th>产品名称</th>
                <th>产品编码</th>
                <th>数量（瓶）/扫码次数</th>
                <th>操作</th>
            </tr>
            <#if (pagelist.result?size > 0)>
                <#list pagelist.result as item>
                    <tr>
                        <td>${item.id}</td>
                        <td>${item.proname}</td>
                        <td>${item.procode}</td>
                        <td>${item.nubs!}</td>
                        <td>
                           <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#md_edit_price" data-product_id="${item.product_id}" data-proname="${item.proname}"  data-procode="${item.procode}">支付</button>
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="9"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>
        </table>
        <table class="table table-striped table-hover">
        	<tr>
        		<td colspan="13" style="text-align:right;background-color:white;">
        			<a href="javascript:void(0);" name="btn_export"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
        		</td>
        	</tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/salesman?keyword=${keyword!}&page=$page&timeLimitStart=${timeLimitStart!}&timeLimitEnd=${timeLimitEnd!}",pagelist.page,pagelist.pageTotal/>
    </div>
</div>

<!-- md_edit_salesman -->
<div class="modal" id="md_edit_price" tabindex="-1">
    <div class="modal-dialog"  style=" width: 300px;"role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-pencil-square-o"></i> 请确认每瓶支付费用</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_edit_price">
                    <input type="hidden" name="productid"/>
                    <input type="hidden" name="productname"/>
                    <input type="hidden" name="productcode"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><strong class="bold">￥</strong> </label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="0.00" name="price" onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false" onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3') " onafterpaste="if(isNaN(value))execCommand('undo')" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" name="btn_save_price">保存</button>
            </div>
        </div>
    </div>
</div>


</@layout_default>